import path from 'path';
export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: '算家云——AI算力租赁平台 智能|高效|灵活|绿色 GPU算力 AI 智算 大模型',
    htmlAttrs: {
      lang: 'en',
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      {
        name: 'description',
        content:
          '算家云平台是一款高效、便捷的综合算力服务平台，旨在为广大用户提供稳定可靠的算力资源，解决算力供需失衡、成本高、使用门槛高等问题。该平台基于云计算、大数据、人工智能等先进技术，通过灵活的算力调度和高效的算法优化，为用户提供高效、低成本的算力服务。',
      },
      {
        name: 'author',
        content: '贵州算家计算服务有限公司',
      },
      {
        name: 'baidu-site-verification',
        content: 'codeva-pRx4rkjkex',
      },
      {
        name: 'keywords',
        content:
          'GPU服务器,算力租赁,GPU算力租赁,Open-Sora,Llama,Miniconda,Comfyui,stable-diffusion,sd,ChatGLM,飞桨,cuda,AI算力,算力平台,算力资源,AIGC,人工智能,GPU4090,GPU3090,GPU3060,算家云',
      },
      { name: 'format-detection', content: 'telephone=no' },
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: ['element-ui/lib/theme-chalk/index.css', '@/static/reset.css', 'bootstrap/dist/css/bootstrap.css'],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    '~plugins/element-ui',
    '~plugins/axios.js',
    '~api/general.js',
    '~plugins/v-md-editor.js',
    '~plugins/svgicon.js',
    { src: '~/plugins/bootstrap.js', mode: 'client' }
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    '@nuxtjs/proxy',
    'cookie-universal-nuxt'
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {
    // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
    // baseURL: '/',
    proxyHeaders: false,
    credentials: false,
    // proxy: true
  },
  // proxy: {//配置代理地址
  //   '/api': {
  //     target: "http://127.0.0.1:3022/container/api",
  //     pathRewrite: {
  //       '^/api': ''
  //     },
  //     changeOrigin: true
  //   }
  // },
  // 
  server: {
    port: 8001,
    host: '0.0.0.0'
  },
  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    transpile: [/^element-ui/],
    extend(config) {
      // 排除默认的 SVG 规则
      const svgRule = config.module.rules.find(rule => rule.test.test('.svg'));
      svgRule.exclude = [path.resolve(__dirname, 'assets/icons')];

      // 添加新的 SVG 规则
      config.module.rules.push({
        test: /\.svg$/,
        loader: 'svg-sprite-loader',
        include: [path.resolve(__dirname, 'assets/icons')],
        options: {
          symbolId: 'icon-[name]'
        }
      });
    },
  },
  router: {
    middleware: 'auth',
    dynamicRoutes: [
      {
        match: 'mirror-*', // 使用通配符定义路由
        component: 'mirror/_id' // 对应的组件
      }
    ]
  }
}
